package com.itheima.homework.pojo;

public class Student {

    public Student() {
    }

    public Student(String username, Integer age, Integer gender, String password) {
        this.username = username;
        this.age = age;
        this.gender = gender;
        this.password = password;
    }

    public Student(String username, Integer age, Integer gender, String password, String newPassword) {
        this.username = username;
        this.age = age;
        this.gender = gender;
        this.password = password;
        this.newPassword = newPassword;
    }

    private String username;
    private Integer age;
    private Integer gender;
    private String password;

    private String newPassword;

    public String getNewPassword() {
        return newPassword;
    }

    public void setNewPassword(String newPassword) {
        this.newPassword = newPassword;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Student desensitization() {
        // 这里重新创建一个对象，做了深拷贝，防止篡改源数据
        return new Student(this.username, this.age, this.gender, "******");
    }

    @Override
    public String toString() {
        return "Student{" +
                "username='" + username + '\'' +
                ", age=" + age +
                ", gender=" + gender +
                ", password='" + password + '\'' +
                '}';
    }

    public enum StudentGender {
        MAN(1),
        FEMALE(2);

        StudentGender(int gender) {
            this.gender = gender;
        }

        public final int gender;
    }
}
